import request from '@/utils/request.js'
import { useTokenStore } from "@/stores/token.js";

// //用户信息查询
// //查询时需要从 pinia 中 获取登录获得的 JWT令牌
// export const articleCategoryListService = () => {
//     //实例一个 pinia
//     const tokenStore = useTokenStore();
//     // alert(tokenStore.token);
//     //获取token
//     //tokenStore.token

//     //在 pinia定义的响应式数据 可以不用.value ，可以直接使用
//     //return request.get('/category',{headers:{'Authorization':tokenStore.token}})
//     return request.get('/category')
// }

//export 把函数暴露出去
//获取全部用户信息
export const userInfoListService = ()=>{
    return request.post('/user/list');
}

// //export 把函数暴露出去
// //文章分类添加
// export const articleCategoryAddService = (categoryData) => {
//     return request.post('/category', categoryData);
// }

// //文章分类修改 update
// export const articleCategoryUpdateService = (categoryData) => {
//     return request.put('/category', categoryData);
// }

// //文章分类删除 delete
// export const articleCategoryDeleteService = (id) => {
//     return request.delete('/category?id=' + id);
// }

// //获取文章详情 get(id) list 
// export const articleInfoListService = (pageNum,pageSize,categoryId,state) => {
//     //return request.get('/article?pageNum=' + pageNum+'&pageSize='+pageSize+'&categoryId='+categoryId+'&state='+state);
//     return request.get('/article?pageNum=' + pageNum+'&pageSize='+pageSize);
// }


//用户信息修改 update
export const updateUserInfoService = (user) => {
    return request.post('/user/update', user);
}

//用户信息删除 delete
export const deleteUserInfoService = (user) => {
    return request.post('/user/delete', user);
}

//用户信息添加 add
export const addUserInfoService = (user) => {
    return request.post('/user/add', user);
}